/*
 * Object.cpp
 *
 *  Created on: 09/11/2011
 *      Author: arleudo
 */

#include "lang/Object.h"
#include "lang/World.h"
#include "Includes.h"

using namespace sf::Key;
using namespace util;

namespace lang
{
	//--------------------------------------------------------------------------------
	Object::Object( sf::Sprite* target )
	{
		sprite = target;
		jumpForce = 15;
	}
	//--------------------------------------------------------------------------------
	Object::~Object()
	{
		for ( unsigned int i = 0; i < animation.size(); i++ )
		{
			delete animation[i];
		}
		animation.clear();
	}
	//--------------------------------------------------------------------------------
	void Object::addAnimation( Animation* animation )
	{
		this->animation.push_back( animation );
	}
	//--------------------------------------------------------------------------------
	bool Object::colide( Object* target )
	{
		if ( this->getX() + this->getWidth() / 3 < target->getX() )
		{
			return false;
		}
		if ( this->getX() > target->getX() + target->getWidth() / 3 )
		{
			return false;
		}
		if ( this->getY() + this->getHeight() < target->getY() )
		{
			return false;
		}

		return true;
	}
	//--------------------------------------------------------------------------------
	void Object::colisionHandler( Object* target )
	{
		PRINT( "tratando  colisao : Object" )
	}
	//--------------------------------------------------------------------------------
	void Object::load( void )
	{
		//Do nothing
	}
	//--------------------------------------------------------------------------------
	void Object::move( void )
	{
		//Do nothing
	}
	//--------------------------------------------------------------------------------
	void Object::runAnimation( void )
	{
		// Do nothing
	}
	//--------------------------------------------------------------------------------
	void Object::update( void )
	{
		//Do nothing
	}

} // namespace lang
